FROM python:3.11-alpine as base
 
RUN apt-get update && apt install netcat-traditional dnsutils libev-dev logrotate binutils libproj-dev ca-certificates -y

RUN pip install --upgrade pip
RUN pip install poetry

WORKDIR /srv/server

FROM base as dependencies

COPY poetry.lock .
COPY pyproject.toml .
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi

COPY . .

FROM dependencies as variables

ENV PATH="${PATH}:/"
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

FROM variables as final
EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
